Skip to content

Use FfiConverterArrayBuffer not FfiConverterBytes for byte arrays#32

Closed
criccomini wants to merge 1 commit intolivekit:mainfrom
criccomini:fix-30
Closed

Use FfiConverterArrayBuffer not FfiConverterBytes for byte arrays#32
criccomini wants to merge 1 commit intolivekit:mainfrom
criccomini:fix-30

Conversation

@criccomini
Copy link
Copy Markdown

Fix an inconsistency in the Node generator. Bytes arguments were lowered as raw byte arrays even when the emitted ffi-rs signature expected a UniffiRustBufferStruct.

The patch updates Type::Bytes to use the same RustBuffer-backed lower/lift path as other serialized types like String, Map, Sequence, Enum, and Record. That means generated bindings now:

  • lower byte arguments into UniffiRustBufferValue.allocateWithBytes(...).toStruct() before the FFI call
  • lift byte return values from the RustBuffer returned by FFI
  • use FfiConverterArrayBuffer consistently for bytes

This brings the generated call-site representation back in line with the generated FFI signatures and removes the need for downstream post-generation patches.

Added a generator regression test covering bytes round_trip(bytes input), and the current Rust test suite passes.

Fixes #30
Fixes #31

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 23, 2026

CLA assistant check
All committers have signed the CLA.

@criccomini
Copy link
Copy Markdown
Author

cc @1egoman

@criccomini criccomini closed this by deleting the head repository Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants